#ifndef MYTREEMODEL_H
#define MYTREEMODEL_H

#include <QSqlQueryModel>
#include <QStyledItemDelegate>
#include <QMap>
#include "my_defs.h"
#include "logger.h"
#include "treeitem.h"

// Клас моделі для дерева
class MyTreeModel : public QSqlQueryModel
{
    Q_OBJECT
public:
    MyTreeModel(QObject *parent = 0);
    Qt::ItemFlags flags(const QModelIndex &index) const;
    QVariant data(const QModelIndex &item, int role) const;
    QModelIndex parent(const QModelIndex &child) const;


    QMap<int, QModelIndex> parents;

    void fun();
private:
    void refresh();
    void generateParents();


    TreeItem *rootItem;


    void setupModelData(TreeItem *parentItem);
signals:

public slots:

};

#endif // MYTREEMODEL_H
